#ifndef CSTEMCELL_H
#define CSTEMCELL_H

#include "main.h"
#include "array"
#include "PARStemCell.h"
#include "vector"

class CStemCell{
private:
    std::array<double,NUMVAR> _X;
    std::array<double,3> _dynamic;
    int _cellid;
    PARStemCell _par;
    bool _ProfQ;
    double _age;
    std::array<double,NUMVAR> getNextEpi();      // Get the epigenetic state of the daughter cell given the value y after DNA duplication.
    PARStemCell getNextPar(double mutationrate,double varsigma, const std::vector<std::array<double,NUMMUTPAR>> & sys_genemat );
    void calcDynamic(double u,int N0, PARStemCell & sys_par,double dt);
    double getOneEpi(int i,  double x1, double x2);
public:
    // 移动构造函数
    CStemCell(CStemCell&& other) noexcept : // 使用noexcept来表明这个构造函数不会抛出异常
            _X(std::move(other._X)),
            _dynamic(std::move(other._dynamic)),
            _cellid(other._cellid),
            _par(std::move(other._par)),
            _ProfQ(other._ProfQ),
            _age(other._age)
    {
        // 将原对象的状态清空，以避免资源泄露
        other._par = PARStemCell(); // 假设PARstemCell有一个默认构造函数
    }

    void printInfo(std::string msg = "------") const;

    CStemCell& operator=(const CStemCell&); // 默认移动赋值操作符
    CStemCell getNextStemCell(double mutationrate,double varsigma,const std::vector<std::array<double,NUMMUTPAR>> & sys_genemat );
    // 通过环境中的数据进行初始化
    void init(PARStemCell & init_par);
	~CStemCell();

    CStemCell(); // 默认构造函数声明
    CStemCell(const CStemCell& other); // 拷贝构造函数声明

	friend class CSystem;
};
#endif